using HMCollada.FX;
using System.Xml;
namespace HMCollada.FX {
    internal struct HMColladaNewParam {
        internal string sid;
        internal string semantic;
        internal HMColladaValueType VALUE_TYPE;
    }
}

namespace HMCollada {
    internal partial class HMColladaLoader {
        private static HMColladaNewParam LoadNewParam() {
            HMColladaNewParam newParam = new HMColladaNewParam();
            newParam.sid = colladaReader.GetAttribute("sid");

            if (!colladaReader.IsEmptyElement) colladaReader.Read();
            do {
                if (colladaReader.NodeType != XmlNodeType.EndElement) {
                    switch (colladaReader.Name) {
                        case "semantic": newParam.semantic = ReadString().Trim(); break;
                        case "float": newParam.VALUE_TYPE = new HMColladaFloat(ReadFloat()); break;
                        case "float2": newParam.VALUE_TYPE = new HMColladaFloat2(ReadFloat(2)); break;
                        case "float3": newParam.VALUE_TYPE = new HMColladaFloat3(ReadFloat(3)); break;
                        // surface and sampler2D should also be handled at some point
                    }
                }

                if (!colladaReader.IsEmptyElement) colladaReader.Read();
            } while (colladaReader.Name != "newparam");

            if (colladaReader.IsEmptyElement) colladaReader.Read();
            return newParam;
        }
    }
}